package com.t114514.demo.mapper;

import com.t114514.demo.pojo.Message;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageMapper {
    @Insert("insert into message(studentId,teacherId,content,createTime,teacherName) values(#{studentId},#{teacherId},#{content},now(),#{teacherName})")
    void insertMessage(Message message);

    List<Message> selectMessage(int teacherId);

    List<Message> selectMessageByteacherName(String teacherName);

    @Delete("delete from message where messageId = #{messageId}")
    void deleteMessage(int messageId);
}
